package com.diandian.backend.dingding.data.controller;

import com.diandian.backend.dingding.data.service.DingdingStaffSyncService;
import com.diandian.base.boot.starter.response.BaseResult;
import com.diandian.base.boot.starter.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * [钉钉]员工表
 */
@RestController
@RequestMapping("/staff")
public class DingdingStaffSyncController {

    @Autowired
    private DingdingStaffSyncService dingdingStaffSyncService;

    /**
     * 拉取员工信息
     */
    @GetMapping("/pull")
    public BaseResult pullStaff(@RequestHeader(value = "appKey") String appKey,
                                @RequestHeader(value = "appSecret") String appSecret,
                                @RequestHeader(value = "belong") String belong,
                                @RequestParam(value = "startIndex", required = false) Integer startIndex,
                                @RequestParam(value = "endIndex", required = false) Integer endIndex) {
        dingdingStaffSyncService.pullStaff(appKey, appSecret, belong, startIndex, endIndex);
        return ResultUtil.makeResult();
    }
}